;(function($){
	this.myFavor = function(){
		
		var deleteBtn;//删除按钮
		var btnConfirm;//确认删除
		var btnCancel;//取消删除
		
		var loadEvent = function(){
			
			deleteBtn.on('click',showDel);//弹出删除蒙层
			
			btnCancel.on('click',cancelDelete);//取消删除
			
			btnConfirm.on('click',confirmDelete);//确认删除
			
			
		};

		//弹出删除蒙层
		var showDel = function(){
			$(this).parent().next().fadeIn();
			$(this).parents('.favor-rstblock').css('opacity','1');
		};
		
		//取消删除
		var cancelDelete = function(){
			$(this).parents('.favor-rstblock-mask').fadeOut();
			$(this).parents('.favor-rstblock').css('opacity','');
		};
		
		//确认删除
		var confirmDelete = function(){
			//此处调用后台删除数据
			var wrapper = $(this).parents('.clearfix');
			var favorNum = wrapper.parent().find('.favor-title>span');
			if(favorNum.length !== 0){
				favorNum.html(favorNum.html() - 1);
			}
			$(this).parents('.favor-rstblock').remove();
			if(wrapper.find('.favor-rstblock').length === 0){
				wrapper.find('.nodata').show();
			}		
			};

		return {
			run:function(){
				deleteBtn = $('.favor-rstblock-cancel.icon-trash');
				btnConfirm = $('.btn-confirm');
				btnCancel = $('.btn-cancel')
				loadEvent();
			}
		};
	}();

})(jQuery);